﻿using System;
using System.Data;
using System.Collections.Generic;
using TTSIDAL;
using TTSModel;

namespace TTSBLL
{
    public class Assemble
    {
        private static readonly IAssemble dal = DALFactory.TTS_DataAccess.CreateAssemble();

        public bool Assemble_Insert(AssembleInfo ai, DataTable dt)
        {
            return dal.Assemble_Insert(ai, dt);
        }

        public AssembleInfo Assemble_GetbySN(string sn)
        {
            return dal.Assemble_GetbySN(sn);
        }

        public IList<AssembleInfo> Assemble_GetbyDT(DateTime dt1, DateTime dt2)
        {
            return dal.Assemble_GetbyDT(dt1, dt2);
        }

        //-----------------------------以上只传递，以下有处理--------------------------------------------------
        /// <summary>
        /// SN是否作为主装配件装配过
        /// </summary>
        /// <param name="sn"></param>
        /// <returns></returns>
        public bool Assemble_SNAlreadyExist(string sn)
        {
            return !string.IsNullOrEmpty(dal.Assemble_GetbySN(sn).SN);
        }
        public void AssembleDeleteBySN(string sn,string storedProcedureName)
        {
            dal.Assemble_DeletebySN(sn,storedProcedureName);
        }
    }
}
